#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int arr[100] = {0};
	int i = 0;
	int n = 0;
	int j = 0;
	int k = 0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	    scanf("%d",&arr[i]);
	}
	scanf("%d",&k);
	j = n - 1;
	for(;j >= 0;j--)
	{
	    if(arr[j] > k)
		{
		    arr[j+1] = arr[j];
		}
		else
		{
		    break;
		}
	}
	arr[j+1] = k;
	for(i=0;i<=n;i++)
	{
	    printf("%d ",arr[i]);
	}
	printf("\n");
    return 0;
}


